package com.weizhizs.assistant.code.helper;

import java.lang.reflect.Method;

/**
 * @author wutianbin
 * @Time：2017年5月26日 上午10:21:40
 * @version 1.0
 */
public class BeanHelper {

    public static void getBeanSetterMethod(Class<?> clazz) {
        Method[] methods = clazz.getDeclaredMethods();
        for (Method m : methods) {
            String methodName = m.getName();

            if (methodName.startsWith("set")) {
                String getterName = "get" + methodName.substring(3);
                // weixinDO.setOrderTimeStart(requestInDTO.getOrderTimeStart());
                System.out
                        .println("weixinDO." + methodName + "(payRequestDO." + getterName + "());");
            }
        }
    }

    public static String getBeanClassName(String fullClassName) {
        int pos = fullClassName.lastIndexOf(".");
        return fullClassName.substring(pos + 1);
    }

    public static void main(String[] args) {
//        Class<?> clazz = com.travel.pay.model.trade.TradeListDO.class;
//        getBeanSetterMethod(clazz);
        String s = getBeanClassName("com.travel.pay.model.trade.TradeListDO");
        System.out.println(s);
    }

}
